﻿@model List<BDShop.Entities.Category>
@using BDShop.Business.Cache
@using BDShop.Entities
@using BDShop.Utilities.Managers

<nav id="menu" class="m-menu">
    <span>Danh mục</span>
    <ul>
        <li class="categories"><a>Danh mục hàng</a>
            <div>

                @{
                    string url;
                }

                @foreach (var category in Model)
                {
                    List<Category> lstChildCategory = CategoryCache.GetParent(category.ID);
                    url = UrlManager.ProductOfCatUrl(category.ID, category.Name);
                    
                    <div class="column">
                        <a href="@url">@category.Name</a>
                        <div>
                            <ul>
                                @if (lstChildCategory.Count > 0)
                                {
                                    foreach (var childCat in lstChildCategory)
                                    {
                                        url = UrlManager.ProductOfCatUrl(childCat.ID, childCat.Name);
                                    <li><a href="@url">@childCat.Name</a></li>
                                    }

                                }
                            </ul>
                        </div>
                    </div>
                }

            </div>
        </li>
    </ul>
</nav>
